package com.bawei.lib_common.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment

abstract class BaseFragment <VDB :ViewDataBinding>:Fragment() {

    lateinit var mDatatBinding:VDB

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
       mDatatBinding= DataBindingUtil.inflate(inflater,getLayoutId(),container,false)
        return mDatatBinding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initViews()
    }

    fun showToastMsg(msg:String){
        if(!msg.isNullOrEmpty()){
            com.blankj.utilcode.util.ToastUtils.showLong(msg)
        }
    }



    abstract fun getLayoutId(): Int
    abstract fun initViews()
}